package com.easy.easylibdemo.ui.greendao.adapter;

import android.content.Context;
import android.view.View;

import com.easy.easylibdemo.R;
import com.easy.easylibdemo.ui.greendao.model.SearchRecordBean;
import com.guyj.CommonAdapter;
import com.guyj.base.ViewHolder;

import java.util.List;

/**
 * 作　　者: guyj
 * 修改日期: 2017/2/9
 * 描　　述:
 * 备　　注:
 */
public class SearchRecordAdapter extends CommonAdapter<SearchRecordBean>{

    public void setFilter(boolean filter) {
        isFilter = filter;
    }

    private boolean isFilter;

    public SearchRecordAdapter(Context context, int layoutId, List<SearchRecordBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder viewHolder, SearchRecordBean searchRecordBean, int i) {
        viewHolder.setText(R.id.tv_name,searchRecordBean.getSearchRecord());
        if (isFilter){
            viewHolder.getView(R.id.iv_delete).setVisibility(View.GONE);
        }else {
            viewHolder.getView(R.id.iv_delete).setVisibility(View.VISIBLE);
        }
        viewHolder.setOnItemChildClickListener(R.id.tv_name);
        viewHolder.setOnItemChildClickListener(R.id.iv_delete);

    }

}
